package com.soo.hoo.core.model;

import com.soo.hoo.core.enums.OperatorEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * <p>
 * 匹配项信息
 * </p>
 *
 * @author 杨燚
 * @since 2022/3/29
 */
@Data
@Schema(name = "MatchItem", title = "匹配项",description = "匹配项")
@AllArgsConstructor
public class MatchItem implements Serializable {

    @Serial
    private static final long serialVersionUID = 629423191945285413L;
    /**
     * 匹配项（字段）名称
     */
    @Schema(name = "column", description = "匹配项（字段）名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String column;

    /**
     * 检索值
     */
    @Schema(name = "value", description = "检索值",requiredMode = Schema.RequiredMode.REQUIRED)
    private Object value;

    /**
     * 运算符，匹配方式
     */
    @Schema(name = "operator", description = "匹配方式，默认精准匹配", ref = "OperatorEnum")
    private OperatorEnum operator;

    /**
     * 子句嵌套
     */
    @Schema(name = "and", description = "子句嵌套，默认交集")
    private Boolean and;


    public MatchItem() {
        this.operator = OperatorEnum.EQ;
        this.and = true;
    }
}
